package com.ccp.dev.qbdms.service;

import com.ccp.dev.core.basic.web.query.QueryFilter;
import com.ccp.dev.form.service.impl.ScriptImpl;
import com.ccp.dev.qbdms.consts.ZhiLiangConst;
import com.ccp.dev.qbdms.model.WQbdReportTemplate;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

import com.ccp.dev.qbdms.util.BaseUtil;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;

/**
 * ClassDescribe:
 *
 * @author :milihao
 * @date :2020-07-21 Since:1
 */
@Service
public class ZeroFaultInformationStatisticsService {

	@Resource
	private WQbdReportTemplateService wQbdReportTemplateService;
	@Resource
	public ScriptImpl scriptimpl;

	public List<Map<String, Object>> getChartData(QueryFilter queryFilter) {
		ZhiLiangConst.addQueryFilter(queryFilter);
		Map<String, Object> querymap = new HashMap<>();
		querymap.put("secret", scriptimpl.getCurrentUser().getPrivacyLevel());
		querymap.put("belongdeptname", BaseUtil.getCurrentTenOrgCodePath() + "%");
		querymap.put("filldeptHospitalId", queryFilter.get("filldeptHospitalId"));
		querymap.put("reportStatus", queryFilter.get("reportStatus"));
		WQbdReportTemplate wQbdReportTemplate = new WQbdReportTemplate();
		if (null != queryFilter.get("beginTime")) {
			wQbdReportTemplate.setZeroFailShootingRangeStart((Date) queryFilter.get("beginTime"));
		}
		if (null != queryFilter.get("endTime")) {
			wQbdReportTemplate.setZeroFailShootingRangeEnd((Date) queryFilter.get("endTime"));
		}
		return (List<Map<String, Object>>) wQbdReportTemplateService
				.getZeroFailure(wQbdReportTemplate, querymap).get("data");
	}
}
